<template> 
    <div class="app-container">
        <!--        <el-card class="filter-container" shadow="never">-->
        <!--            <div>-->
        <!--                <i class="el-icon-search"></i>-->
        <!--                <span>筛选搜索</span>-->
        <!--                <el-button-->
        <!--                        style="float: right"-->
        <!--                        @click="searchWebLogList()"-->
        <!--                        type="primary"-->
        <!--                        size="small">-->
        <!--                    查询结果-->
        <!--                </el-button>-->
        <!--            </div>-->
        <!--            <div style="margin-top: 15px">-->
        <!--                <el-form :inline="true" :model="listQuery" size="small" label-width="140px">-->
        <!--                    <el-form-item label="输入搜索：">-->
        <!--                        <el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>-->
        <!--                    </el-form-item>-->
        <!--                </el-form>-->
        <!--            </div>-->
        <!--        </el-card>-->
        <el-card class="operate-container" shadow="never">
            <i class="el-icon-tickets"></i>
            <span>数据列表</span>
        </el-card>
        <div class="table-container">
            <el-table ref="webLogTable"
                      :data="list"
                      style="width: 100%"
                      @selection-change="handleSelectionChange"
                      v-loading="listLoading"
                      border>

                <el-table-column label="模块" align="center">
                    <template slot-scope="scope">{{scope.row.title}}</template>
                </el-table-column>
                <el-table-column label="业务类型" align="center">
                    <template slot-scope="scope">{{scope.row.businessType}}</template>
                </el-table-column>
                <el-table-column label="操作类别" align="center">
                    <template slot-scope="scope">{{scope.row.operatorType}}</template>
                </el-table-column>
                <el-table-column label="操作人员" align="center">
                    <template slot-scope="scope">{{scope.row.operName}}</template>
                </el-table-column>
                <el-table-column label="主机地址" align="center">
                    <template slot-scope="scope">{{scope.row.operIp}}</template>
                </el-table-column>
                <el-table-column label="操作地点" align="center">
                    <template slot-scope="scope">{{scope.row.operLocation}}</template>
                </el-table-column>
                <el-table-column label="登录状态" align="center">
                    <template slot-scope="scope">{{scope.row.status|formatStatus}}</template>
                </el-table-column>
                <!--                <el-table-column label="错误消息" align="center">-->
                <!--                    <template slot-scope="scope">{{scope.row.errorMsg}}</template>-->
                <!--                </el-table-column>-->
                <el-table-column label="操作时间" align="center">
                    <template slot-scope="scope">{{scope.row.operTime|formatCreateTime}}</template>
                </el-table-column>

            </el-table>
        </div>
        <div class="pagination-container">
            <el-pagination
                    background
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    layout="total, sizes,prev, pager, next,jumper"
                    :page-size="listQuery.pageSize"
                    :page-sizes="[5,10,15]"
                    :current-page.sync="listQuery.pageNum"
                    :total="total">
            </el-pagination>
        </div>
    </div>
</template>
<script>
    import {SysLogininforList, SysOperLogList} from '@/api/sys/operateLog'
    import {formatDate} from '@/utils/date';

    export default {
        name: 'webLogList',
        data() {
            return {
                operates: [
                    {
                        label: "显示品牌",
                        value: "showWebLog"
                    },
                    {
                        label: "隐藏品牌",
                        value: "hideWebLog"
                    }
                ],
                operateType: null,
                listQuery: {
                    keyword: null,
                    pageNum: 1,
                    pageSize: 10
                },
                list: null,
                total: null,
                listLoading: true,
                multipleSelection: []
            }
        },
        created() {
            this.getList();
        },
        filters: {
            formatCreateTime(time) {
                let date = new Date(time);
                return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
            },

            formatStatus(value) {
                if (value === 0) {
                    return '成功';
                } else if (value === 1) {
                    return '失败';
                }
            },
        },
        methods: {
            getList() {
                this.listLoading = true;
                SysOperLogList(this.listQuery).then(response => {
                    this.listLoading = false;
                    this.list = response.data.records;
                    this.total = response.data.total;
                    this.totalPage = response.data.pages;
                    this.pageSize = response.data.size;
                });
            },
            handleSelectionChange(val) {
                this.multipleSelection = val;
            },
            getProductList(index, row) {
                console.log(index, row);
            },
            getProductCommentList(index, row) {
                console.log(index, row);
            },

            handleSizeChange(val) {
                this.listQuery.pageNum = 1;
                this.listQuery.pageSize = val;
                this.getList();
            },
            handleCurrentChange(val) {
                this.listQuery.pageNum = val;
                this.getList();
            },
            searchWebLogList() {
                this.listQuery.pageNum = 1;
                this.getList();
            },
        }
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>


</style>


